<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扫码销分</title>
    <style>
        .title{
            font-size: 4em;
            color: white;
            height: 150px;
        }
        .jfdh{
            font-size: 3em;
            margin-top: 1em;
        }
        .list{
            font-size: 2.5em;
            margin-top: 1em;
            color:rgb(0,150,136);
            margin-left: 2em;
        }
        .scan{
            float:right;margin-top:7em;
            margin-right: 7em;
        }
        .content{
            margin-top:3em;
            float:left;
            margin-left: 6em;
        }
        .line{
            margin-top: 28em;
        }
        .point{
            font-size: 2em;
        }
        .layui-layer-btn0{
            height: 50px;
        }
        .bu{
            height: 80px;
        }
        .l0 {
            background-color: red;
        }

    </style>
</head>
<link rel="stylesheet" href="/html/layui/css/layui.css" media="all" />
<link rel="stylesheet" type="text/css" href="/themes/rzjj/public/assets/fonts/mobile/iconfont.css">

<body>
<div>
    <div class="jfdhBlockSty" style=" background-color: rgb(0,111,196)">
        <div class="jfdhTitle title">
         扫码销分
        </div>
    </div>
</div>
<div class="content" >
    <div class="jfdhTitle jfdh"  >
        操作员：{$user_login}
    </div>
    <div class="jfdhTitle jfdh">
        次数：{$times}次
    </div>
    <div class="jfdhTitle jfdh">
        累计已消：{$points}分
    </div>
</div>
<div class="scan">
    <a href="javascript:;"  onclick="scan()" ><image src="__STATIC__/images/scan.png" style="margin-left: 0px"/></a>
</div>
<div class="line">
<hr>
    <foreach name="log" id="vo">
        <div class="jfdhTitle list"><span class="point">●&nbsp;</span>{$vo.ctime|date="Y-m-d H:i"}——{$vo.user.user_nickname}——{$vo.point}分</div>
        <hr>
    </foreach>
</div>



</body>

<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="/html/layui/layui.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js" type="text/javascript" charset="utf-8"></script>
</html>
<script type="text/javascript">

    layui.use('layer', function() { //独立版的layer无需执行这一句
         layer = layui.layer;

    })
        function get_layer_open(_data) {
            layui.use('layer', function() { //独立版的layer无需执行这一句
                var layer = layui.layer; //独立版的layer无需执行这一句
                layer.open({
                    type: 1,
                    title: false //不显示标题栏
                    ,
                    closeBtn: false,
                    area: '600px;',
                    shade: 0.5,
                    id: 'LAY_layuipro' //设定一个id，防止重复弹出
                    ,
//            btn: ['确认销分', '先不了'],
//            btnAlign: 'c',
                    moveType: 1 //拖拽模式，0或者1
                    ,
                    content: '<div style="padding: 50px; line-height: 60px; background-color: #393D49; color: #ffff00; font-weight: 300;font-size: 3em">销分券信息：<br>车牌号：'+_data.car_num+'<br><br>分值：'+_data.point+'分<br></div><div class="layui-layer-btn layui-layer-btn-c bu"><a class="layui-layer-btn0" style="height: 54px;margin: 4px 78px 13px -60px;font-size: 3em;line-height: 48px;">确认销分</a><a class="layui-layer-btn1" style="height: 54px;font-size: 3em;line-height: 48px;">先不了</a></div>'
                    ,
                    yes: function(){
                        layer.closeAll()
                        $.ajax({
                            type: "GET",
                            url: "do_check_points",
                            data: {id:_data.id},
                            dataType: "json",
                            success: function(rsp){
                                layer.msg(rsp.errmsg)
                                setTimeout(function (){
                                    window.location.reload();
                                }, 1000);
                            }
                        });
                    },
                });
            })
//        layui.use('layer', function() { //独立版的layer无需执行这一句
//            var layer = layui.layer; //独立版的layer无需执行这一句
//            layer.open({
//                type: 1,
//                title: false //不显示标题栏
//                ,
//                closeBtn: false,
//                area: '300px;',
//                shade: 0.8,
//                id: 'LAY_layuipro' //设定一个id，防止重复弹出
//                ,
//                btn: ['确认销分', '先不了'],
//                btnAlign: 'c',
//                moveType: 1 //拖拽模式，0或者1
//                ,
//                content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #ffff00; font-weight: 300;">销分券信息：<br>车牌号：'+_data.car_num+'<br><br>分值：'+_data.point+'分<br></div>'
//                ,
//                yes: function(){
//                    layer.closeAll()
//                    $.ajax({
//                        type: "GET",
//                        url: "do_check_points",
//                        data: {id:_data.id},
//                        dataType: "json",
//                        success: function(rsp){
//                            layer.msg(rsp.errmsg)
//                        }
//                    });
//                },
//            });
//        })
    }
//    function scan() {
//        var result = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzaHVrZXIiLCJhdWQiOiIiLCJjdGltZSI6MTU3NDc0MDczMywic3RhcnRfdGltZSI6MTU3NDc0MDczMywiZW5kX3RpbWUiOjE2MDYzNjMxMzMsInVzZXJfaWQiOjI5LCJwb2ludCI6MiwiY2FyX251bSI6ImFzZGFkYWQyMTIxIn0.0mj-IOjYqQG-7d5WZq8q_03SdJ9CcUUcUuLWq74oABE'
//                //window.location.href =result;
//                $.ajax({
//                    type: "GET",
//                    url: "ajax_get_points",
//                    data: {check_code:result},
//                    dataType: "json",
//                    success: function(rsp){
//                        console.log(rsp)
//                        if(rsp.error){
//                            layer.msg(rsp.errmsg);
//                        }else{
//                            get_layer_open(rsp.data);
//                        }
//
//                    }
//                });
//    }

    function scan() {
        wx.config(<?php echo $app->jssdk->buildConfig(array('scanQRCode'), false) ?>);
        wx.scanQRCode({
            needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
            scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
            success: function (res) {
                var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                //window.location.href =result;
                $.ajax({
                    type: "GET",
                    url: "ajax_get_points",
                    data: {check_code:result},
                    dataType: "json",
                    success: function(rsp){
                        if(rsp.error){
                            layer.msg(rsp.errmsg);
                        }
                        get_layer_open(rsp.data);
                    }
                });
            }
        })
    }

</script>